package com.example.liteflow.itr;

import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeForComponent;
import com.yomahub.liteflow.slot.Slot;
import lombok.extern.slf4j.Slf4j;

/**
 * 次数循环组件
 *
 * @author chen.an
 * @date 2024-08-14 17:46
 */
@Slf4j
@LiteflowComponent(id = "ForNode1", name = "次数循环（num/2）")
public class ForNode extends NodeForComponent {
    @Override
    public int processFor() throws Exception {
        Slot slot = this.getSlot();
        int num = slot.getRequestData();
        log.info("ForNode1 节点组件【{}】-ForNode,获取数据：{}", Thread.currentThread().threadId(), num);
        return num / 2;
    }
}
